<?php

class UserFace extends FaceBase
{
	private $nohf = ['updateUserInfo'];
	private $mysql = null;
	private $api = null;
	private $weixin = null;

	public function __construct()
	{
		parent::__construct();
		if(!in_array(N_ACTION,$this->nohf)){
			n_mod('skin')->header();
		}
		$this->mysql = n_api('mysql')->cname('weixin');
		// $this->api = n_api('user');
	}

	public function index()
	{
		$ppid = $_SESSION['ppid'];
		$rs = n_api('passport')->get($ppid);
		$this->_html('index', $rs);
	}

	public function updateUserInfo()
	{
		$param = $this->param("
			nickname:char:ignore,
			birthday:char:ignore,
			gender:char:ignore,
			job:char:ignore,
			phone:char:ignore
		");

		$where = "id = {$_SESSION['ppid']}";
		$this->mysql->update('passport_main', $param, $where);
		echo 'update successfully';
	}


	public function __destruct(){
		//加入标准尾。
		if(!in_array(N_ACTION,$this->nohf) && 'page'==N_TYPE){
			n_mod('skin')->footer();
		}
	}

}